<?php
namespace app\index\controller;
use app\index\model\ConnectQuiz;

class Practice extends \think\Controller
{
    public function index()
    {	
        $title="Blog template";
		$text="Enim labore aliqua consequat ut quis ad occaecat aliquip incididunt. Sunt nulla eu enim irure enim nostrud aliqua consectetur ad consectetur sunt ullamco officia. Ex officia laborum et consequat duis.";
		$images="PUBLIC/img/example-work01.jpg";
		$Quiz=new ConnectQuiz;
    	$row=$Quiz->select();
    	$row=json_decode(json_encode($row),true);
    	for($index=0;$index<count($row);$index++) {
    		$answers=explode('###', $row[$index]['answer']);
    		$arr[] = array(
    			'question' => $row[$index]['id'].'、'.$row[$index]['question'],
    			'answers' => $answers
    			);
    	}
    	$json=json_encode($arr);
    	// $this->assign('json',$json);
    	// return $this->fetch('index');
		$data['title']=$title;
		$data['text']=$text;
		$data['images']=$images;
		$data['json']=$json;	
		$this->assign('data',$data);	
        return $this->fetch('index');
    }
    public function score()
    {
    	 
    }
}